#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>

extern "C" int c_generate(char *outbuf,char *resultbuf,int len);
#pragma comment(lib,"c_generator.lib")

const int buflen=1000;
int main()
{
	char outbuf[buflen];
	char resultbuf[buflen];
	char tempbuf[buflen];
	char result_tempbuf[buflen];
	printf("\r\nOutput ..\r\n");
	memset(outbuf,0,sizeof(outbuf));
	memset(resultbuf,0,sizeof(outbuf));
	memset(tempbuf,0,sizeof(tempbuf));
	memset(result_tempbuf,0,sizeof(tempbuf));
	c_generate(outbuf,resultbuf,buflen);
	printf(outbuf);
	printf("\r\n");
	printf(resultbuf);
	*tempbuf=0;
	for(int i=0;i<9;i++)
	{
		strncat(tempbuf,outbuf+i*9,9);
		strcat(tempbuf,"\r\n");
	}
	printf("\r\n\r\n%s\r\n",tempbuf);


	printf("\r\nOutput ..\r\n");
	memset(outbuf,0,sizeof(outbuf));
	memset(resultbuf,0,sizeof(outbuf));
	memset(tempbuf,0,sizeof(tempbuf));
	memset(result_tempbuf,0,sizeof(tempbuf));
	c_generate(outbuf,resultbuf,buflen);
	printf(outbuf);
	printf("\r\n");
	printf(resultbuf);
	*tempbuf=0;
	for(int i=0;i<9;i++)
	{
		strncat(tempbuf,outbuf+i*9,9);
		strcat(tempbuf,"\r\n");
	}
	printf("\r\n\r\n%s\r\n",tempbuf);

	printf("\r\nOutput ..\r\n");
	memset(outbuf,0,sizeof(outbuf));
	memset(resultbuf,0,sizeof(outbuf));
	memset(tempbuf,0,sizeof(tempbuf));
	memset(result_tempbuf,0,sizeof(tempbuf));
	c_generate(outbuf,resultbuf,buflen);
	printf(outbuf);
	printf("\r\n");
	printf(resultbuf);
	*tempbuf=0;
	for(int i=0;i<9;i++)
	{
		strncat(tempbuf,outbuf+i*9,9);
		strcat(tempbuf,"\r\n");
	}
	printf("\r\n\r\n%s\r\n",tempbuf);
	return 0;
}